package com.fbs.chicken.shirodemo.user.web;

import com.fbs.chicken.shirodemo.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录注册相关
 */
@RestController
@RequestMapping("/login")
public class LoginController {

    @PostMapping("/login")
    public String login(String name, String password) {
        userService.login(name, password);
        return "OK";
    }

    @PostMapping("/signup")
    public String signup(String name, String password) {
        userService.signup(name, password);
        return "OK";
    }

    private UserService userService;
    @Autowired
    public LoginController(UserService userService) {
        this.userService = userService;
    }
}
